using System;
using System.Collections.Generic;
using System.Text;

namespace AjGenesisStudio.Commands
{
    class NewFileCommand : Command
    {

        public override bool Execute()
        {
            OpenNew("txt");
            return true;
        }

        public bool Execute(string extension)
        {
            OpenNew(extension);
            return true;
        }

        private void OpenNew(string ext)
        {
            Global.Instance.StartWork();
            
            Documents.Document doc = null;
            switch (ext)
            {
                case "tpl":
                    doc = new Documents.TemplateDocument();
                    break;
                //case "":
                //    //doc = new Documents.;
                //    break;
                default:
                    doc = new Documents.Document();
                    break;
            }

            doc.DefaultExtension = ext;
            doc.Open();
            Global.Instance.MainForm.ShowDocument(doc);

            Global.Instance.EndWork();
        }
    }
}
